<template>
  <div style="width: 300px; height: 100%">
    <ElementDialog ref="dialog" embed :visible="visible" title="办理环节" :width="width">
      <ElForm label-width="120px" label-position="right">
        <ElFormItem label="环节" prop="activityId">
          <ElRadioGroup v-model="paramsObj.activityName" size="medium" style="width: 100%">
            <ElRadio
              v-for="item in data"
              :key="item.nodeId"
              style="display: block; margin-top: 10px; font-size: 24px"
              :label="item.nodeName"
              :value="item.nodeId">
              {{ item.nodeName }}
            </ElRadio>
          </ElRadioGroup>
        </ElFormItem>
        <ElRow class="form-row">
          <ElCol :span="24">
            <ElFormItem label="回退理由">
              <ElInput v-model="paramsObj.comment" type="textarea" rows="3" />
            </ElFormItem>
          </ElCol>
        </ElRow>
      </ElForm>
      <template #footer>
        <ElButton type="primary" @click="getHandleRecordActivityInfo">确定</ElButton>
      </template>
    </ElementDialog>
  </div>
</template>

<script>
  export default {
    name: 'ReturnTaskUserModel',
    props: {
      visible: Boolean
    },
    data() {
      return {
        paramsObj: {
          comment: '',
          activityId: '',
          activityName: '',
          userCode: ''
        },
        data: [],
        width: '55vw'
      }
    },
    created() {
      this.init()
    },
    methods: {
      init() {
        // let params = { taskId: this.taskId, processInstanceId: this.processInstanceId }
        // findReturnTaskList(params).then(response => {
        //   this.data = response.data.data
        // })
      },
      change(rows) {
        this.rows = rows
      },
      setReturnTaskList(returntaskList) {
        this.data = returntaskList
      },
      getHandleRecordActivityInfo() {
        if (this.$isBlank(this.paramsObj.activityName)) {
          this.$message.warning('请选择回退节点！')
          return
        }
        if (this.$isBlank(this.paramsObj.comment)) {
          this.$message.warning('请输入回退理由！')
          return
        }
        this.data.forEach(row => {
          if (row.nodeName === this.paramsObj.activityName) {
            this.paramsObj.activityId = row.nodeId
            this.paramsObj.userCode = row.userCode
          }
        })
        this.$emit('getHandleRecordActivityInfo', this.paramsObj)
        this.$refs.dialog.hide()
      }
    }
  }
</script>

<style>
  .el-radio__label {
    font-size: 20px;
  }
</style>
